home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / SCSI Samples 1.0 / SCSI Async Sample 06⁄15 ƒ / Src / MicrosecondTrap.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-16  |  1.7 KB  |  73 lines  |  [TEXT/KAHL]

  1. /*                                    MicrosecondTrap.h                                */
  2. /*
  3.  * MicrosecondTrap.h
  4.  * Copyright © 1994 Apple Computer Inc. All rights reserved.
  5.  */
  6. #ifndef __MicrosecondTrap__
  7. #define __MicrosecondTrap__
  8. #include <Types.h>
  9. #include <Traps.h>
  10. #include <Timer.h>
  11.  
  12. /*
  13.  * These definitions are needed for the Microsecond Trap only if you have not
  14.  * upgraded to the Universal Headers.
  15.  */
  16. #ifndef __MIXEDMODE__
  17. /*
  18.  * MixedMode.h is defined for the Universal Headers. If it wasn't defined, we'll
  19.  * define a 64-bit unsigned integer here.
  20.  */
  21. #if defined(powerc) || defined (__powerc)
  22. #pragma options align=mac68k
  23. #endif
  24. struct UnsignedWide {
  25.     unsigned long                hi;
  26.     unsigned long                lo;
  27. };
  28. #if defined(powerc) || defined(__powerc)
  29. #pragma options align=reset
  30. #endif
  31. typedef struct UnsignedWide UnsignedWide;
  32. #endif /* __MIXEDMODE__ */
  33.  
  34. #ifndef __powerc
  35. /*
  36.  * This trap returns the number of microseconds, but is not yet defined in all public
  37.  * headers. It is present on all systems that support the extended time manager..
  38.  */
  39. #ifndef _Microseconds
  40. #define _Microseconds    0xA193
  41. #pragma parameter Microseconds(__A1)
  42. pascal void Microseconds(UnsignedWide *microsecondCount) =
  43.   {0xA193, 0x225F, 0x22C8, 0x2280};
  44. #endif    /* _Microseconds */
  45. #endif    /* __powerc */
  46.  
  47.  
  48. /*
  49.  * TRUE if the Microsecond Trap is present.
  50.  */
  51. Boolean                        MicrosecondTrapPresent(void);
  52.  
  53. /*
  54.  * Convert a Microsecond value to a double-precision number of microseconds.
  55.  */
  56. double                        MicrosecondToDouble(
  57.         register const UnsignedWide    *epochPtr
  58.     );
  59.  
  60. /*
  61.  * Return the difference between two Microsecond Trap values.
  62.  * Integer subtraction is used to preserve accuracy.
  63.  */
  64. void
  65. MicrosecondDelta(
  66.         register const UnsignedWide    *startPtr,
  67.         register const UnsignedWide    *endPtr,
  68.         register UnsignedWide        *result
  69.     );
  70. #endif /* __MicrosecondTrap__ */
  71.  
  72.  
  73.